home *** CD-ROM | disk | FTP | other *** search
- Path: news.informatik.uni-muenchen.de!usenet
- From: Kurt Watzka <watzka@stat.uni-muenchen.de>
- Newsgroups: comp.lang.c++
- Subject: Re: Class problem
- Date: Tue, 27 Feb 1996 19:21:34 +0100
- Organization: Institut fⁿr Statistik
- Message-ID: <31334BAE.6E09@stat.uni-muenchen.de>
- NNTP-Posting-Host: pc9.stat.uni-muenchen.de
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (WinNT; I)
-
- Pam Layton wrote:
- >
- > Hi. I'm new at C++ programming. I am working on a program (that
- > is to be complete by 2/28/96). I have to have one class of name
- > information, and one class of address information. I have a menu
- > to choose whether to add, display, remove or exit. I have most of
- > the code written. My problem: I use Borland C++ ver. 3.1. It
- > keeps giving me an error saying "Illegal Structure Operation" on
- > these two lines:
- > cin >> addr.zip;
- > cin >> addr.phone;
- >
- > Both of these fields are listed within my address class. I have it
- > listed as:
- > class addr_data:public name_data
- > {
- > public:
- > char street[25];
- > char city[15];
- > char state[3];
- > int zip[11];
- > int phone[10];
- > }addr;
- >
- > Can someone please tell me what is wrong with this picture? I
- > appreciate it.
-
- You don't have an "istream &operator>>(istream &is, int *)",
- and you probably don't want it. Most phone numbers and ZIP codes
- can be stored in an int, and those few that cannot, canot be stored
- in an array of int, either.
-
- Think about
-
- a) Changing "zip" and "phone" to int or
- b) Changing them to arrays of char.
-
- Kurt
-